from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop010_销售管理退货管理处理退货"

firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox) #调用函数登录dbshop的后台
DBshopEnterMenu2(firefox,'销售管理','退货管理')
rootPath=get_pro_rootpath() #获取项目的绝对路径
filePath=rootPath+r'\public\order1.txt' #拼接文件路径
orderNo=readFile(filePath) #读取文件中的订单编号



firefox.find_element_by_xpath('//td[text()="%s"]/following-sibling::td[5]/a[1]'%orderNo).click()
firefox.find_element_by_xpath('//input[@id="refund_price"]').clear()

# a= firefox.find_element_by_xpath('//a[@href="/dbshop/goods/8/14"]/../following-sibling::td[5]').text
# print(a)
firefox.find_element_by_xpath('//input[@id="refund_price"]').send_keys(3558)
firefox.find_element_by_xpath('//textarea[@id="re_refund_info"]').send_keys("同意")
firefox.find_element_by_xpath('//button').click()

firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)
firefox.find_element_by_link_text("用户中心").click()
firefox.find_element_by_link_text("退货申请").click()

a=firefox.find_element_by_xpath('//td[text()="%s"]/following-sibling::td[4]'%orderNo).text
print(a)
yuqi="查看退货详情"  #这是预期值
#检查点
if yuqi==a:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
firefox.quit()